package xyc.sjxy.exam.service.impl;

import xyc.sjxy.exam.dao.impl.UserDaoImpl;
import xyc.sjxy.exam.pojo.Users;
import xyc.sjxy.exam.service.UserService;

import java.sql.SQLException;
import java.util.List;

public class UserServiceImpl implements UserService {
    private UserDaoImpl userDao=new UserDaoImpl();
    @Override
    public boolean login(String userName, String userPwd) throws SQLException {
        //调用userDao层方法login来验证用户的身份
        Users user = userDao.findByUserName(userName);
        if (user!=null && user.getUserPwd().equals(userPwd)) {
            //登录成功
            return true;
        }

        return false;
    }

    @Override
    public List<Users> getAll() throws SQLException {
        return userDao.findAll();
    }
}
